package com.hmall.user.mapper;

import com.hmall.user.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface UserMapper extends BaseMapper<User> {
    @Update("update tb_user set balance = balance - ${money} where user_id = #{userId}")
    int deduct(@Param("userId") String userId, @Param("money") int money);

    @Update("update tb_user set balance = balance + ${money} where user_id = #{userId}")
    int refund(@Param("userId") String userId, @Param("money") int money);

}